package com.liujing.simplefactory;

/**
 * @program: DesignPattenDemo
 * @description:简单工厂模式测试类
 * @author: liujing
 * @create: 2019-11-21 10:05
 **/
public class Test {
    public static void main(String[] args) {
        Operation operationAdd = OperationFactory.createOperation("+");
        operationAdd.setNumberA(10);
        operationAdd.setNumberB(15);
        System.out.println("结果为： " + operationAdd.getResult());

        Operation operationSub = OperationFactory.createOperation("-");
        operationSub.setNumberA(10);
        operationSub.setNumberB(15);
        System.out.println("结果为： " + operationSub.getResult());

        Operation operationMul = OperationFactory.createOperation("*");
        operationMul.setNumberA(10);
        operationMul.setNumberB(15);
        System.out.println("结果为： " + operationMul.getResult());

        Operation operationDiv = OperationFactory.createOperation("/");
        operationDiv.setNumberA(10);
        operationDiv.setNumberB(15);
        System.out.println("结果为： " + operationDiv.getResult());
    }

}
